using System.IO;
public class FileHandle
{
    /// <summary>
    /// 保存文件
    /// </summary>
    /// <param name="content">内容</param>
    /// <param name="path">保存文件位置</param>
    public static void SaveFile(string content, string path)
    {
        StreamWriter streamWriter;
        FileStream fileStream;
        if (File.Exists(path))
        {
            File.Delete(path);
        }
        fileStream = new FileStream(path, FileMode.Create);
        streamWriter = new StreamWriter(fileStream);
        streamWriter.Write(content);
        streamWriter.Close();
    }

    public static void SaveFile(byte[] bytes, string path)
    {
        if (File.Exists(path))
        {
            File.Delete(path);
        }
        using (FileStream fs = new FileStream(path, FileMode.CreateNew))
        {
            fs.Write(bytes);
        }
    }
}
